package cn.cnf.common.exception;

import cn.cnf.common.enums.StatusCode;
import lombok.Data;
import lombok.EqualsAndHashCode;

/**
 * @author ZhuMeiYi
 * @date 2020/12/7 17:40
 * @description
 */
@EqualsAndHashCode(callSuper = true)
@Data
public class CustomException extends RuntimeException {
    private int code;
    private String message;

    public CustomException(StatusCode statusCode) {
        this.code = statusCode.getCode();
        this.message = statusCode.getMessage();
    }

    public CustomException(String message) {
        this.code = StatusCode.SUCCESS.getCode();
        this.message = message;
    }
}
